package com.huluobo.a2204parkdemo.signIn

import androidx.lifecycle.MutableLiveData
import com.huluobo.base.mvvm.BaseViewModel
import com.huluobo.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import okhttp3.RequestBody
import javax.inject.Inject

/**
 *  Created by LC on 2024/8/21.
 */
@HiltViewModel
class SignInViewModel @Inject constructor(
    val apiService: ApiService
) : BaseViewModel() {
    val signInSuccess by lazy { MutableLiveData<String>() }

    fun signIn(body: RequestBody) {
        executeNetRequest(
            { apiService.signIn(body) },
            signInSuccess::postValue
        )
    }

    val signOutSuccess by lazy { MutableLiveData<String>() }
    fun signOut(body: RequestBody) {
        executeNetRequest(
            { apiService.signOut(body) },
            signOutSuccess::postValue
        )
    }

    val signMonthSuccess by lazy { MutableLiveData<String>() }
    fun getMonthSign(body: RequestBody) {
        executeNetRequest(
            { apiService.getMonthSign(body) },
            signMonthSuccess::postValue
        )
    }
}